# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Valery Kartel <valery.kartel@gmail.com>
pkgname=php7-pecl-gmagick
_pkgreal=gmagick
pkgver=2.0.5_rc1
_pkgver=${pkgver/_rc/RC}
pkgrel=6
pkgdesc="PHP bindings to the GraphicsMagick library - PECL"
url="https://pecl.php.net/package/gmagick"
arch="all"
license="PHP-3.01"
depends="php7-common ghostscript-fonts"
makedepends="graphicsmagick-dev autoconf libtool php7-dev"
source="https://pecl.php.net/get/$_pkgreal-$_pkgver.tgz"
builddir="$srcdir/$_pkgreal-$_pkgver"
provides="php7-gmagick=$pkgver-r$pkgrel" # for backward compatibility
replaces="php7-gmagick" # for backward compatibility

build() {
	phpize7
	./configure \
		--prefix=/usr \
		--with-php-config=/usr/bin/php-config7
	make
}

check() {
	if [ "$CARCH" = "x86" ]; then
		# https://gitlab.alpinelinux.org/alpine/aports/issues/11011
		rm -f \
			tests/gmagick-107_setimagevirtualpixelmethod.phpt \
			tests/gmagick-116_waveImage_basic.phpt
	fi
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	install -d "$pkgdir"/etc/php7/conf.d
	echo "extension=$_pkgreal.so" > "$pkgdir"/etc/php7/conf.d/$_pkgreal.ini
}

sha512sums="217ad5ba2df7f6092fbb2dc13918f85658793033ba03550657be1ff44dc51ae0533a7ae86c0b14c60e8a0dc8fe9af16daffa01cc50a4096d269ad55d60a3dfb8  gmagick-2.0.5RC1.tgz"
